package com.example.an.intentboadcast;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private Button myButton = null;
    private final String nobody ="Who.care.the.name";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myButton = (Button)findViewById(R.id.myButton);
        myButton.setOnClickListener(new MyButtonListener());

    }
    class MyButtonListener implements View.OnClickListener{

        @Override
        public void onClick(View view) {
            Intent intent=new Intent(nobody);
            //添加键值对
            intent.putExtra("test","qqwqw11251252152152");
            sendBroadcast(intent);
        }
    }
}
